package com.gxa.controller.HhyController;

import com.gxa.service.PatientBookService;
import com.gxa.utils.R;
import com.gxa.vo.MakeVo;
import com.gxa.vo.PatientBookVo;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Api(tags="某患者预约信息接口")
@RestController
public class PatientBookController {

    @Autowired
    private PatientBookService patientBookService;

    @ApiOperation(value = "患者挂号预约类型选择接口",produces = "application/json",response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header",dataType ="String" ,required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息",examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:sel")
    @GetMapping("/patientBook/patientInfo")
    public R patientInfo(@ApiParam(name="appRegister-为参数名",value = "核酸信息参数--这里写参数描述",required = true)String phone){
        System.out.println(phone);
        List<PatientBookVo> list = this.patientBookService.selectByPatientCard(phone);

//        patientBookVo.setId(1);
//        patientBookVo.setBookType("大保健");
//        patientBookVo.setDepartName("保健科");
//        patientBookVo.setMedCard("1234444");
//        patientBookVo.setDoctorName("张三");
//        patientBookVo.setType("专家号");
//        patientBookVo.setMoney(60);
//        patientBookVo.setTime("2022-05-04");
//        patientBookVo.setStatus(1);

        return R.ok().put("data",list);

    }

    @ApiOperation(value = "修改状态接口",produces = "application/json",response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header",dataType ="String" ,required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息",examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:update")
    @GetMapping("/update/updateStatus")
    public R updateStatus(@ApiParam(name="appRegister-为参数名",value = "核酸信息参数--这里写参数描述",required = true)Integer id){
        this.patientBookService.updateStatus(id);
        System.out.println(id);//更据id修改预约表状态已取消（3）
        return R.ok();
    }
}
